package logic

import (
	"context"
	"day15/api/pkg"

	"day15/api/internal/svc"
	"day15/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type UserRealNameLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewUserRealNameLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserRealNameLogic {
	return &UserRealNameLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *UserRealNameLogic) UserRealName(req *types.UserRealNameRequest) (resp *types.ApiResponse, err error) {
	// todo: add your logic here and delete this line
	if pkg.RealName(req.Name, req.Id) {
		return &types.ApiResponse{
			Code: 200,
			Msg:  "实名认证成功",
			Data: nil,
		}, nil
	}
	return &types.ApiResponse{
		Code: 0,
		Msg:  "实名认证失败",
		Data: nil,
	}, nil
}
